package com.diuse.config;

import javax.swing.plaf.synth.SynthTextAreaUI;
import java.net.Socket;

/**
 *
 * 在服务端检查过期时间时候需要记录上一次的心跳时间
 * Created by carey on 2016/11/20 0020.
 */
public class HeartBeatHolder {

    private Socket socket;
    private long lastCheckTime;

    /**
     *
     * @param socket 不能为空
     */
    public HeartBeatHolder(Socket socket){

        this.socket = socket;
        lastCheckTime = System.currentTimeMillis();
    }

    public long getLastCheckTime() {
        return lastCheckTime;
    }

    public void setLastCheckTime(long lastCheckTime) {
        this.lastCheckTime = lastCheckTime;
    }

    public Socket getSocket() {
        return socket;
    }

    public void setSocket(Socket socket) {
        this.socket = socket;
    }

    @Override
    public boolean equals(Object o){
        return socket.equals(o);
    }

    public int hashCode(){
        return socket.hashCode();
    }
}
